Skip to content

e2e: own the shared fakeagent build directory and clean it up (plan 056) - #669

Closed
andyrewlee wants to merge 1 commit into
advisor/055-async-project-treefrom
advisor/056-fakeagent-build-cleanup
Closed

andyrewlee wants to merge 1 commit into
advisor/055-async-project-treefrom
advisor/056-fakeagent-build-cleanup

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Summary

Plan 056 of the advisor series. The shared e2e fake-agent binary was built into an amux-fakeagent-* temp dir that nothing owned — failed builds leaked partial outputs and successful builds outlived every test process.

  • buildFakeAgentBinary(destRoot, runBuild): injectable helper that creates an owned amux-fakeagent-* dir, removes it immediately on build failure (partial outputs included), and keeps it on success so the shared binary stays available to every test in the process.
  • cleanupBuiltFakeAgent/cleanupOwnedFakeAgentDir: process-level cleanup invoked from TestMain after m.Run() — guarded to the owned directory prefix (refuses unrelated paths), idempotent, no-op when nothing was built, and preserves the original test exit code.
  • internal/e2e/fakeagent_cleanup_test.go: failure cleanup, deferred success cleanup, empty-path no-op, unexpected-path refusal with a sentinel preserved, and a subprocess lifecycle proof (private TMPDIR → helper build → path exists mid-test → gone after TestMain exit).

The shared binary deliberately gets no per-test cleanup — TestFakeAgentRecordsRawCarriageReturn runs in parallel and depends on it.

Test plan

  • go test ./internal/e2e -run 'Test.*FakeAgent.*(Build|Cleanup)' — all green incl. subprocess lifecycle
  • go test ./internal/e2e ./internal/e2e/fakeagent -run 'Test(FakeAgent|RecordStream|ReadyBanner|OpenLogFile)' — green
  • go test -race ./internal/e2e -run 'Test.*FakeAgent' — green
  • make verify-loop — both raw-agent tests pass against the shared binary
  • go test ./internal/tmux ./internal/e2e -count=1 — assertions all pass; only the known ambient flakes (TempDir teardown, wheel-timing) under host load
  • make test-race-tmux, make devcheck — same ambient-flake caveat
  • make lint-strict-new — 0 issues
  • Full e2e suite green in pre-push hook

Stacked on #668.

The shared fake-agent binary was built into an amux-fakeagent-* temp dir
that nothing owned: failed builds leaked partial outputs and the
successful binary outlived every test process. Give the fixture an owner:
the injectable build helper removes its owned dir immediately on failure,
and TestMain removes the successful build after m.Run() — guarded to the
owned prefix so cleanup can never sweep an unrelated path, and idempotent
so a second call is a no-op.

The shared binary intentionally gets no per-test cleanup: the parallel
raw-carriage-return fixture depends on it for the process lifetime.

Gates: cleanup/fixture/race suites green; verify-loop green with both
raw-agent tests; isolated tmux/e2e + devcheck assertions all pass — the
only failures are the known ambient e2e flakes under host load (TempDir
RemoveAll teardown, one wheel-coordinate delivery timing), each proven
non-regressions by isolated reruns.
@andyrewlee

Copy link
Copy Markdown
Owner Author

Superseded — content landed on main via merge 8580442 (plans/ scaffolding intentionally excluded).

@andyrewlee andyrewlee closed this Sep 28, 2026
@andyrewlee
andyrewlee deleted the advisor/056-fakeagent-build-cleanup branch September 28, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant